import request from '@/utils/request'

// 添加微信模板
export function addTemplate(data) {
  return request({
    url: '/wx/kd/msg/template_msg/add',
    method: 'post',
    data: data
  })
}

export function updateTemplate(data) {
  return request({
    url: '/wx/kd/msg/template_msg/update',
    method: 'post',
    data: data
  })
}

export function templateInfo(templateId) {
  return request({
    url: '/wx/kd/msg/template_msg/detail',
    method: 'get',
    params: { templateId }
  })
}

export function listTemplate(data) {
  return request({
    url: '/wx/kd/msg/template_msg/list',
    method: 'post',
    data: data
  })
}

export function addTemplateConfig(data) {
  return request({
    url: '/wx/kd/msg/template_msg_config/add',
    method: 'post',
    data: data
  })
}
export function updateTemplateConfig(data) {
  return request({
    url: '/wx/kd/msg/template_msg_config/update',
    method: 'post',
    data: data
  })
}

export function templateConfigInfo(configId) {
  return request({
    url: '/wx/kd/msg/template_msg_config/info',
    method: 'get',
    params: { configId }
  })
}

export function deleteTemplateConfig(configId) {
  return request({
    url: '/wx/kd/msg/template_msg_config/delete',
    method: 'post',
    data: { configId: configId }
  })
}

export function templateConfigList(data) {
  return request({
    url: '/wx/kd/msg/template_msg_config/list',
    method: 'post',
    data: data
  })
}

export function sendMsg(data) {
  return request({
    url: '/wx/kd/msg/template_msg/send/example',
    method: 'post',
    data: data
  })
}

export function getTplKeywords(params) {
  return request({
    url: '/wx/kd/msg/wxa/public_tpl_keywords',
    method: 'get',
    params: params
  })
}

export function getWxaCategory(params) {
  return request({
    url: '/wx/kd/msg/wxa/category',
    method: 'get',
    params: params
  })
}
export function getPresetAppList() {
  return request({
    url: '/wx/kd/msg/template_msg/preset_app_list',
    method: 'get'
  })
}

export function getPrivateTemplateList(params) {
  return request({
    url: '/wx/kd/msg/wxa/all_private_template',
    method: 'get',
    params: params
  })
}

export function getPublicTplList(params) {
  return request({
    url: '/wx/kd/msg/wxa/public_tpl_list',
    method: 'get',
    params: params
  })
}

/* 商户消息管理*/
// 订单消息规则列表
export function getOrderMsgRuleList(params) {
  return request({
    url: '/wx/kd/msg/order_msg_rule/list',
    method: 'post',
    data: params
  })
}
// 新增规则通知
export function addOrderMsgRuleList(params) {
  return request({
    url: '/wx/kd/msg/order_msg_rule/add',
    method: 'post',
    data: params
  })
}
// 修改订单消息状态
export function changeOrderMsgState(params) {
  return request({
    url: '/wx/kd/msg/order_msg_rule/changeState',
    method: 'post',
    data: params
  })
}

export function editOrderMsgRule(params) {
  return request({
    url: '/wx/kd/msg/order_msg_rule/edit',
    method: 'post',
    data: params
  })
}

